#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>

 void sig(){
        printf("TIME IS OUT!");
        exit(0);
    }

int main(){
    int ret = -1;
   signal(SIGALRM,sig);
   ret = alarm(3);
   printf("alarm返回值：%d \n",ret);
   while(1);  //死循环凑够3S
   return 0;
}